<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            position: absolute;
            background-color: pink;
        }
    </style>
</head>

<body>
    <div></div>
    <script>
        var box = document.querySelector("div")
        document.onmousemove = function (event) {
            var e = event || window.event
            box.style.top = e.clientY + "px"
            box.style.left = e.clientX + "px"
            box.innerHTML = `${e.clientX}px,${e.clientY}px`
        }
    </script>
</body>

</html>